/**
 * Project Name:swt-hello <br/>
 * File Name:App.java <br/>
 * Package Name:com.ftu.z <br/>
 */
package com.ftu.swt.basic4;

import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.MenuItem;


/**
 * <p>  </p>
 * @version 1.0 2018年11月22日 mq 修改内容:初版
 */
public class UsingMenu {
    public static void main(String[] args) {
        final Display display = Display.getDefault();
        Shell shell1 = new Shell(display);
        shell1.setText("shell1");
        shell1.setSize(400, 400);
        
        Menu menu = new Menu(shell1, SWT.BAR);
        shell1.setMenuBar(menu);
        
        MenuItem mntmNewItem = new MenuItem(menu, SWT.NONE);
        mntmNewItem.setText("New Item");
        
        MenuItem mntmFile = new MenuItem(menu, SWT.CASCADE);
        mntmFile.setText("File");
        
        Menu menu_1 = new Menu(mntmFile);
        mntmFile.setMenu(menu_1);
        
        MenuItem mntmItem_1 = new MenuItem(menu_1, SWT.NONE);
        mntmItem_1.setText("item2");
        
        MenuItem mntmItem = new MenuItem(menu_1, SWT.NONE);
        mntmItem.setText("item1");
        
        
        
        
        
        
        
        shell1.open();
        while(!shell1.isDisposed()) {
            if(!display.readAndDispatch()) {
                display.sleep();
            }
        }
        display.dispose();
        
    }
}
